package models

import (
	"github.com/gin-gonic/gin"
	"strconv"
)

func GetClassGrade(i int) (re string) {
	switch i {
	case 1:
		re = "大一"
	case 2:
		re = "大二"
	case 3:
		re = "大三"
	case 4:
		re = "大四"
	}
	return
}

// GetPageInfo 处理分页请求的参数
func GetPageInfo(c *gin.Context) (page, page_size int, err error) {
	//获得分页参数offer和limit
	pageStr := c.Query("page")
	page_sizeStr := c.Query("size")
	page, err = strconv.Atoi(pageStr)
	if err != nil {
		page = 1
	}
	page_size, err = strconv.Atoi(page_sizeStr)
	if err != nil {
		page_size = 10
	}
	return
}
